/**
 * Created by lyf on 17-6-22.
 */
console.log(location.href)
// var userId = location.href.split('?')[1];
var person = JSON.parse(sessionStorage.getItem("person"));
//console.log(person)
//var userId= person.userid;
// console.log(userId)
if (person==''||person==null) {
    $('.login_success').hide();
} else{
    var userId=person.userid;
    $('.login_success').show();
    $('.login_hide').hide()
}
$('.tuichu').on('click',function(){
    sessionStorage.clear();
})
$('.tutorService').on('click',function () {
    if (person==''||person==null) {
        window.location.href='../html/denglu.html';
    }else {
        $.ajax({
            url: 'http://114.112.96.184:18080/auth/toTutor' ,
            type: 'get',
            data: {'userId':userId},
            async: false,
            success: function (data) {
                console.log(data);
                if(data.result > 0){
                    window.location.href='../html/daoshi_index.html';
                }
                if(data.result == 0){
                    alert('您的信息正在审核，请稍后！')
                }
                if (data.result == null||data.result<0) {
                    window.location.href='../html/daoshirenzheng_1.html';
                }

            },
            error: function (returndata) {

            }
        });
    }
})